﻿using MVCDemo.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using System.Web;

namespace MVCDemo.DAL
{
    public class AccountContext:DbContext
    {
        //指定一个连接字符串，默认和类名一致，在web.config中
        public AccountContext()
            : base("AccountContext")
        { }

        public DbSet<SysUser> SysUsers { get; set; }

        public DbSet<SysRole> SysRoles { get; set; }
        public DbSet<SysUserRole> SysUserRoles { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            // 默认生成复数的表 如 SysUsers
            //base.OnModelCreating(modelBuilder);
            //
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
        }
    }
}